package com.diana.springcloud.cloudconsumer.controller;

import com.diana.springcloud.cloudconsumer.entity.UserEntity;
import com.diana.springcloud.cloudconsumer.feign.UserFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Suna
 * @Date 2020/8/24 16:52
 */
@RestController
public class UserController {

    @Autowired
    UserFeignClient userFeignClient;

    @GetMapping("/user/{userId}")
    public UserEntity getUser(@PathVariable int userId){
        UserEntity userEntity = new UserEntity();
        userEntity = userFeignClient.getUser(userId);
        return userEntity;
    }
}
